<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png" />
    <h1 @click="fun">{{name}}</h1>
    <h2 v-for="(item,index) in list" :key="index">{{item.title + '--' +item.price}}</h2>

    <!-- <h1>折扣列表</h1>
    <h3 v-for="(item,index) in lowPrice" :key="index+5">{{item.title + '--' +item.price}}</h3> -->
  <!-- <h1>{{ user.name }}---{{ user.telephone }}----{{ user.address }}</h1>
  <h1>{{ token }}---{{ loginToken}}</h1> -->
 
 
  </div>


</template>

<script>
import { mapState ,mapGetters,mapMutations,mapActions} from 'vuex'


export default {
  name: "Home",
  data() {
    return {
      
    }
  },created() {
    console.log('///',this.$store)
  },
  computed:{
    // ...mapState(['name','list']),
    ...mapState({
      'name': state => state.name,
      'list': state => state.list,
      'token': state => state.token,
      'user': state => state.login.user,
      'loginToken': state => state.login.token

    }),
    ...mapGetters(['lowPrice'])
  },
  methods: {
    ...mapActions(['mapAction']),
    ...mapMutations(['updateName']),
    //这个方式要加路径 而且不常用
    // ...mapMutations({
    //   'updateName': 'login/updateName'
    // }),
    fun(){
      this.updateName(':');
      this.action1()
    }
  },
};
</script>
